<?php
namespace app\index\controller;

use think\Controller;
use think\facade\Request;

class Index extends Controller
{
    public function index()
    {
        $userData = db('demo')->order('id','desc')->select();
        $this->assign(['info'=>$userData]);
    	return view();
     }


    public function add()
    {
       if (Request::isAjax())
       {
           $data =  Request::param();
            $res = model('add')->add($data);
            if ($res['valid'])
            {
                return ['status'=>1,'msg'=>$res['msg']];
            }else{
                return ['status'=>0,'msg'=>$this->error($res['msg'])];
            }

       }


    }

}
